package demo1;
class OuterClass1{
    public int data1 = 1;
    private int data2 = 2;
    public static int data3 = 3;
    //如何获取 静态内部类对象
    //如何在静态内部类中访问外部类的非静态类数据成员  提供外部类的引用
    //OuterClass2 outerClass2 = new OuterClass();
    //System.out.println(outerClass2.data1);
    static class InnerClass{
        public int data4 = 4;
        private int data5 = 5;
        public static int data6 = 6;
        public void test(){
            OuterClass1 outerClass1 = new OuterClass1();
            System.out.println(outerClass1.data1);
            //System.out.println(data1);
            System.out.println(data4);
            System.out.println(data5);
            System.out.println(data6);
            System.out.println("内部类的test方法");
        }

    }

}
public class Test3 {

    public void func(){
        //局部内部类
        class Inner{
            public int data1 = 27;
        }
        Inner inner = new Inner();
        System.out.println(inner.data1);
    }
    public static void main(String[] args) {
        OuterClass1.InnerClass innerClass = new OuterClass1.InnerClass();
        innerClass.test();
    }
}
